﻿<vsx.ui:DialogWindow x:Class="Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Views.FxCopDictionaryEditorWindow"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:vsx.ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0"
                     Title="FxCop Dictionary Editor"
                     WindowStartupLocation="CenterOwner"
                     MinHeight="500" Height="500" MinWidth="600" Width="600">
    <vsx.ui:DialogWindow.Resources>
        <Style x:Key="dataGrid" TargetType="DataGrid">
            <Setter Property="AutoGenerateColumns" Value="False"/>
            <Setter Property="HorizontalGridLinesBrush" Value="LightGray"/>
            <Setter Property="VerticalGridLinesBrush" Value="LightGray"/>
        </Style>
        <Style x:Key="elementStyle" TargetType="TextBlock">
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsReadOnly}" Value="True">
                    <Setter Property="Foreground" Value="Gray"/>
                    <Setter Property="ToolTip">
                        <Setter.Value>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="pack://application:,,,/Sasa.QualityTools.CodeAnalysis.FxCopIntegrator;component/Resources/Warning.png"/>
                                <TextBlock Text="This word can't edit because it is defined in the default custom dictionary." Margin="5"/>
                            </StackPanel>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="editingElementStyle" TargetType="TextBox">
            <Setter Property="IsReadOnly" Value="{Binding IsReadOnly}"/>
        </Style>
    </vsx.ui:DialogWindow.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TabControl Grid.Row="0" TabStripPlacement="Left">
            <TabItem Header="Recognized" Padding="5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <DataGrid Grid.Row="0" ItemsSource="{Binding Recognized}" Style="{StaticResource dataGrid}">
                        <!--<DataGrid.CommandBindings>
                        <CommandBinding Command="ApplicationCommands.Paste" Executed="Paste" CanExecute="CanPaste"/>
                    </DataGrid.CommandBindings>-->
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Word" Binding="{Binding Value}" Width="200" ElementStyle="{StaticResource elementStyle}" EditingElementStyle="{StaticResource editingElementStyle}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="5">A 'Recognized' term is included the list of terms that code analysis identifies as correctly spelled. Note that FxCop gives priority to 'Unrecognized' when a word is defined as both 'Recognized' and 'Unrecognized'.</TextBlock>
                </Grid>
            </TabItem>
            <TabItem Header="Unrecognized" Padding="5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <DataGrid Grid.Row="0" ItemsSource="{Binding Unrecognized}" Style="{StaticResource dataGrid}">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Word" Binding="{Binding Value}" IsReadOnly="{Binding IsReadOnly}" Width="200" ElementStyle="{StaticResource elementStyle}" EditingElementStyle="{StaticResource editingElementStyle}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="5">An 'Unrecognized' term is excluded the list of terms that code analysis identifies as correctly spelled.</TextBlock>
                </Grid>
            </TabItem>
            <TabItem Header="Deprecated" Padding="5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <DataGrid Grid.Row="0" ItemsSource="{Binding Deprecated}" Style="{StaticResource dataGrid}">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Term" Binding="{Binding Value}" IsReadOnly="{Binding IsReadOnly}" Width="200" ElementStyle="{StaticResource elementStyle}" EditingElementStyle="{StaticResource editingElementStyle}"/>
                            <DataGridTextColumn Header="Preferred Alternate" Binding="{Binding Alternate}" IsReadOnly="{Binding IsReadOnly}" Width="200" ElementStyle="{StaticResource elementStyle}" EditingElementStyle="{StaticResource editingElementStyle}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="5">A 'Deprecated' term is included the list of terms that code analysis identifies as deprecated. 'Preferred Alternate' is used as a suggested alternate term in the violation message.</TextBlock>
                </Grid>
            </TabItem>
            <TabItem Header="Compound" Padding="5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <DataGrid Grid.Row="0" ItemsSource="{Binding Compound}" Style="{StaticResource dataGrid}">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Term" Binding="{Binding Value}" IsReadOnly="{Binding IsReadOnly}" Width="200" ElementStyle="{StaticResource elementStyle}" EditingElementStyle="{StaticResource editingElementStyle}"/>
                            <DataGridTextColumn Header="Compound Alternate" Binding="{Binding Alternate}" IsReadOnly="{Binding IsReadOnly}" Width="200" ElementStyle="{StaticResource elementStyle}" EditingElementStyle="{StaticResource editingElementStyle}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="5">A 'Compound' term is included the list of terms that code analysis identifies as a compound word. 'Compound Alternate' is used as a suggested alternate term in the violation message.</TextBlock>
                </Grid>
            </TabItem>
            <TabItem Header="Discrete Exceptions" Padding="5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <DataGrid Grid.Row="0" ItemsSource="{Binding DiscreteExceptions}" Style="{StaticResource dataGrid}">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Term" Binding="{Binding Value}" IsReadOnly="{Binding IsReadOnly}" Width="200" ElementStyle="{StaticResource elementStyle}" EditingElementStyle="{StaticResource editingElementStyle}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="5">A 'Discrete Exceptions' term is excluded the list of terms that code analysis identifies as a single word.</TextBlock>
                </Grid>
            </TabItem>
            <TabItem Header="Acronyms" Padding="5">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <DataGrid Grid.Row="0" ItemsSource="{Binding CasingExceptions}" Style="{StaticResource dataGrid}">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Acronym" Binding="{Binding Value}" IsReadOnly="{Binding IsReadOnly}" Width="200" ElementStyle="{StaticResource elementStyle}" EditingElementStyle="{StaticResource editingElementStyle}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap" Margin="5">An 'Acronyms' is included the list of terms that code analysis identifies as correctly spelled.</TextBlock>
                </Grid>
            </TabItem>
        </TabControl>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button IsDefault="True" Command="{Binding SaveAndCloseCommand}" Margin="5" Width="80">Save</Button>
            <Button Command="{Binding SaveCommand}" Margin="5" Width="80">Apply</Button>
            <Button IsCancel="True" Command="{Binding CloseCommand}" Margin="5" Width="80">Cancel</Button>
        </StackPanel>
    </Grid>
</vsx.ui:DialogWindow>
